install_keyhook

This function installs a low level keyboard hook that forces any keys to be passed to the game window while it is in focus, regardless of any other running applications.

bool install_keyhook()

Parameters:
None.

Return value:
true if the keyboard hook was successfully installed, false otherwise.

Remarks:
This function is useful if the game uses the Jaws for Windows screenreader interface. However it should only be used if actually required, since it will block any global keys whilst ever the game window is focused. This can include keystrokes that allow the screenreader to perform various internal functions.

Example:
// Install a keyhook and display a message saying that the Insert key has been pressed.

void main()
{
show_game_window("Test Game");
bool success=install_keyhook();
if(!success)
{
alert("Error", "The keyhook could not be installed. Please unload the Jaws for Windows screenreader before playing.");
}
while(true)
{
if(key_down(KEY_LMENU) && key_pressed(KEY_F4))
{
exit();
}
if(key_pressed(KEY_INSERT))
{
alert("Information", "The Insert key was successfully pressed.");
}
// Other code goes here.
wait(5);
}
uninstall_keyhook();
}